﻿<?php
@session_start();

require_once("../../class/mysql.class.php");

  $obj = new Mysql();
  
  $obj -> set_table('user_login');
  $obj -> set_colone("(`*`)");
  $obj -> set_variables(" id_login = '" . $_SESSION["id"] . "' ");
  $user = $obj -> select_enregistrement();
 // echo $user['id_login'];
  
if (isset($_REQUEST['emplacement']))
{
		$emplacement = addslashes($_REQUEST["emplacement"]);
		$description = addslashes($_REQUEST["desc_emplacement"]);
		$req="SELECT * FROM `st_att_lieu_article` WHERE nom_lieu='".$emplacement."'";
		$r=mysql_query($req);
		$num=mysql_num_rows($r);
		if($num<1){
			$sql = "INSERT INTO `st_att_lieu_article` (`id_lieu`, `nom_lieu`,`description`) 
			VALUES 
			('', '".$emplacement."', '".$description."');";
			mysql_query($sql);
			header('location:../../list_emplacement.php?action=added&emplacement='.$emplacement);
		}else{
			header('location:../../list_emplacement.php?action=addedError&emplacement='.$emplacement);
		}
}
